//
//  ViewController.m
//  hd4-20
//
//  Created by mac on 16-4-20.
//  Copyright (c) 2016年 hdf. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()<UITableViewDataSource>
{
    NSArray* data;
}

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    NSLog(@"视图已经加载。");   //appear的意思事显示。
    
    UITableView* tableview = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
    
    tableview.dataSource = self;
    
    [self.view addSubview:tableview];
    
    data =@[
            @"梦若悬、",
            @"长生不死。",
            @"年月花、",
            @"江笑人凉"
            ];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return data.count;
}

- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell* cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:nil];
    cell.textLabel.text = data[indexPath.row];
    cell.detailTextLabel.text= @"grnvuf";
    return cell;
    
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
